//
//  ZYCTeaLeaveRecordFlowChartHeaderView.m
//  ZDSC
//
//  Created by 张威 on 2021/11/9.
//

#import "ZYCTeaLeaveRecordFlowChartHeaderView.h"

@interface ZYCTeaLeaveRecordFlowChartHeaderView ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *titleLabel;
@end
@implementation ZYCTeaLeaveRecordFlowChartHeaderView

- (void)setType:(ZYCFlowChartHeaderViewType)type{
    _type = type;
    if (type == ZYCTeaLeaveFlowChartApplication) {
        NSMutableAttributedString * attriString = [[NSMutableAttributedString alloc] initWithString:@"流程 (审批人依次审批)"];
        [attriString addAttribute:NSForegroundColorAttributeName value:HEX_RGB(@"#999999") range:NSMakeRange(2, 10)];
        [attriString addAttribute:NSFontAttributeName value:kCustomFont(@"PingFangSC-Regular", 13.0f) range:NSMakeRange(2, 10)];
        _titleLabel.attributedText = attriString;
    }else{
        _titleLabel.text = @"流程";
    }
    
}
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = HEX_RGB(@"FFFFFF");
        
        [self addSubview:self.bgView];
        [self addSubview:self.titleLabel];
        [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(self);
            make.height.mas_equalTo(5.0f);
        }];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.0f);
            make.top.equalTo(self.bgView.mas_bottom).offset(10.0f);
        }];
        
 
    }
    return self;
}

- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = HEX_RGB(@"#FAFAFA");
    }
    return _bgView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Medium", 16.0f) titleColor:HEX_RGB(@"#333333") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

@end
